<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

    <a href="#/login">登录</a>
    <a href="#/register">注册</a>

    <div id="app"></div>
    <script type="text/javascript">
        var oDiv = document.getElementById('app')

        // 监控hash值的变化
        window.onhashchange = function () {
            console.log(location.hash)
            switch (location.hash) {
                case '#/login':
                    oDiv.innerHTML = '<h2>我是登录页面</h2>'
                    break
                case '#/register':
                    oDiv.innerHTML = '<h2>我是注册页面</h2>'
                    break
                default:
                    break
            }
        }

    </script>

</body>
</html>
